package operation;

import Dao.MilkDao;
import interfac.OrderOperation;
import pojo.MilkTeaProduct;

import java.util.Scanner;

public class AddStockOperatioon implements OrderOperation {
    @Override
    public void execute(Scanner scanner){
        System.out.println("请输入要进货的奶茶产品ID：");
        int productId = scanner.nextInt();
        scanner.nextLine();

        System.out.println("请输入进货数量：");
        int additionalQuantity = scanner.nextInt();
        scanner.nextLine();

        MilkDao milk_dao = new MilkDao();
        MilkTeaProduct existingProduct = milk_dao.getProductById(productId);
        if (existingProduct!= null) {
            milk_dao.updateStockQuantity(productId, additionalQuantity);
        } else {
            System.out.println("输入的产品ID不存在，请检查后重新输入。");
        }
    }
}
